$(".address-bd .address-option .weui_switch1").click(function() {
    if ($(this).is(':checked')) {
        $(this).siblings(".ceng").hide();
		$(".elevator1").val("2");
		
    } else {
        $(this).siblings(".ceng").show();
		$(".elevator1").val("1");
    }
	Fb();
	chuanAjax();
});

$(".address-bd .address-option .weui_switch2").click(function() {
    if ($(this).is(':checked')) {
        $(this).siblings(".ceng").hide();
		$(".elevator2").val("2");
    } else {
        $(this).siblings(".ceng").show();
		$(".elevator2").val("1");
    }
	Fb();
	chuanAjax();
});
//

function getDate(dates){
	"use strict";
	var dd = new Date();
    dd.setDate(dd.getDate()+dates);
    var y = dd.getFullYear();
    var m = dd.getMonth()+1;
    var d = dd.getDate();
    
	return y+"-"+m+"-"+d;
}

function getMyWeek3(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+3);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}

function getMyWeek4(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+4);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}

function getMyWeek5(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+5);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}

function getMyWeek6(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+6);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}

function getMyWeek7(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+7);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}


$("#select-time").picker({
    title: "预约时间",
    toolbarCloseText: "确认",
    cols: [{
        textAlign: 'center',
        values: ['明天（'+getDate(1)+'）','后天（'+getDate(2)+'）',getMyWeek3()+'（'+getDate(3)+'）',getMyWeek4()+'（'+getDate(4)+'）',getMyWeek5()+'（'+getDate(5)+'）',getMyWeek6()+'（'+getDate(6)+'）',getMyWeek7()+'（'+getDate(7)+'）']
    }, {
        textAlign: 'center',
        values: ['早晨 07:00 - 9:00','上午 09:00 - 11:00', '中午 11:00 - 14:00', '下午 14:00 - 17:00', '傍晚 17:00 - 20:00']
    }],
    onClose: function() {
        $("#select-time").parent(".ban-item").addClass("on");
    }
});
$("#mudiceng").picker({
  title: "请选择楼层",
  cols: [
    {
      textAlign: 'center',
      values: ['1', '2', '3', '4', '5', '6', '7', '8']
    }
  ]
});
$("#chufaceng").picker({
  title: "请选择楼层",
  cols: [
    {
      textAlign: 'center',
      values: ['1', '2', '3', '4', '5', '6', '7', '8']
    }
  ]
});

$("#select-js").picker({
  title: "请选择数量",
  cols: [
    {
      textAlign: 'center',
      /*values: ['1','15到20件','20件以上']*/
	  values: ['1', '2', '3', '4', '5', '6', '7','8','9','10','11','12','13','14','15','15到20件','20件以上']
    }
  ]
});

$(".add").click(function() {
    var n = $(this).prev().val();
    var num = parseInt(n) + 1;
    if (num == 0) {
        return;
    } else {
        $(this).siblings(".jian").removeClass("hide");
        $(this).siblings(".num").removeClass("hide");
         if ($(this).parent().parent().siblings(".bd")) {
         	$(this).parent().parent().siblings(".bd").removeClass("hide");
         }
    }
    $(this).prev().val(num);
});
$(".jian").click(function() {
    var n = $(this).next().val();
    var num = parseInt(n) - 1;
    if (num == 0) {
		$(this).next().val(num);
    	$(this).addClass("hide");
        $(this).siblings(".num").addClass("hide");
        if ($(this).parent().parent().siblings(".bd")) {
		  $(this).parent().parent().siblings(".bd").addClass("hide");
	    }
        return
    }
    $(this).next().val(num);
});


$("#select-jj").click(function () {
	$("#page-home").hide();
	$("#page-select-dxl").fadeIn();
});

$("#change_cart").click(function () {
	$("#page-home").hide();
	$("#page-select-car").fadeIn();
});

function back() {
	$("#page-select-dxl").hide();
	$("#page-select-car").hide();
	$("#page-home").fadeIn();
}
function jsbz() {
	$("#jsbz").removeClass('hide');
}
function close() {
	$("#jsbz").addClass('hide');
}

// 大件家具家电、更改车型回到页面
	$(".jiaju-confirm").click(function() {
		var jiaju="";
		//洗衣机
		if( $(".xiyiji1").val()!=0 ){
			jiaju="普通洗衣机" + $(".xiyiji1").val() + "台 ";
		}
		
		if( $(".xiyiji2").val()!=0 ){
			jiaju=jiaju+"波轮洗衣机" + $(".xiyiji2").val() + "台 ";
		}
		
		if( $(".xiyiji3").val()!=0 ){
			jiaju=jiaju+"滚筒洗衣机" + $(".xiyiji3").val() + "台 ";
		}
		
		//冰箱
		if( $(".bingxiang1").val()!=0 ){
			jiaju=jiaju+"单门小冰箱 1m以下" + $(".bingxiang1").val() + "台 ";
		}
		
		if( $(".bingxiang2").val()!=0 ){
			jiaju=jiaju+"双门冰箱高 1m-1.7m" + $(".bingxiang2").val() + "台 ";
			
		}
		
		if( $(".bingxiang3").val()!=0 ){
			jiaju=jiaju+"双门或三门冰箱高 1.7m以上" + $(".bingxiang3").val() + "台 ";
		}
		
		//床
		if( $(".chuang1").val()!=0 ){
			jiaju=jiaju+"单人床" + $(".chuang1").val() + "张 ";
		}
		
		if( $(".chuang2").val()!=0 ){
			jiaju=jiaju+"双人床" + $(".chuang2").val() + "张 ";
		}
		
		if( $(".chuang3").val()!=0 ){
			jiaju=jiaju+"单人床垫" + $(".chuang3").val() + "张 ";
		}
		
		if( $(".chuang4").val()!=0 ){
			jiaju=jiaju+"双人床垫" + $(".chuang4").val() + "张 ";
		}
		
		//一个人班的件数
		var backup = "";
		if($(".people1").val()!=0){
			backup += "\n 一人搬运:"+$("#bei1").val();
		} 
		
		if($(".people2").val()!=0){
			backup += "\n 二人搬运:"+$("#bei2").val();
		}
		
		
		
		if( $(".bingxiang2").val()!=0 || $(".bingxiang3").val()!=0 || $(".chuang1").val()!=0 || $(".chuang2").val()!=0 || $(".chuang3").val()!=0 || $(".chuang4").val()!=0 || $(".people2").val()!=0){
		   $("#car").val("小型平板货车");
		   $(".car1").hide();
	    }else{
		   $("#car").val("面包车");
		   $(".car1").fadeIn();
		}
		
		$(".ben").val(backup);
		
		$(".option-jj").val(jiaju);
		$("#page-select-dxl").hide();
		$("#page-home").fadeIn();
		
	});